#ifndef UTILGL_H_INCLUDED
#define UTILGL_H_INCLUDED

#include <string>
#include <ctime>
#include <GL/glew.h>
#include "Vector3.h"
#include "Matrix4.h"

namespace prog3d {
/**
@file
@author F. Aubert
@brief quelques tracés utiles

*/

/**
@class UtilGL
@brief quelques fonctionnalités de tracés (toutes les méthodes sont statiques)
*/
class UtilGL {
    static bool _isInitCubeBuffer;
    static GLuint _cubeVertexBuffer;
    static GLuint _cubeIndexBuffer;


    /// draws the buffer (have to be initialized)
    static void drawCubeBuffer();


    public:
    /// trace un cube avec normal aux faces
    static void drawCube(float taille=1.0);

    static void drawCylinder();
    static void drawSphereTexture(int nbSlice,int nbStack);
    static void drawSphere();
    static void drawCone(double r,double h);

    static void drawTorus(double rg=1.0,double rp=0.2);
    static void drawImmediateCube();
    static void drawImmediateSquare();

    static void draw(const Vector3 &p,int size=5);
    static void draw(const Vector3 &p1,const Vector3 &p2,int size=2);
    static void draw(const std::vector<Vector3> &l1,const std::vector<Vector3> &l2);
    static void draw(unsigned int i,const Vector3 &u);
    static void draw(const std::string &s,const Vector3 &p,double dimension=0.05);

    static void initCubeBuffer();

    static void drawDart(const Vector3 &a,const Vector3 &u,float taille=5.0,const std::string &s1="",const std::string &s2="");

    /// affiche la chaine de caractère à la position écran (x,y) (compris entre [-1,1])
    static void draw(std::string s,float x,float y,double height=0.05);


    /// affiche le repère local
    static void drawAxes(float taille=1.0);


    static void materielBleuVert();
    static void materialRed();
    static void init();

    static void drawGrid();
    static void drawGround();

    static void drawSegment(const Vector3 &a,const Vector3 &b);

    static void initLight(GLint light);
    static void materialFrontBack();

};


}

#endif // UTILGL_H_INCLUDED
